/************************************
 * Package: RGcpp					*
 * Authors: Rui Eduardo Gouveia Gil	*
 * Date: 2010						*
 ************************************/
#ifndef __RGCPP_PTYCOMMAND_H__
#define __RGCPP_PTYCOMMAND_H__
#ifndef _WIN32
#include <pty.h>
#include <vector>
#include <string>
#include <sstream>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <signal.h>
#include <iostream>
#include <sys/wait.h>
#include <sys/types.h>

#include "rgcpp/tools/ToString.h"
#include "rgcpp/exceptions/RuntimeException.h"

namespace rgcpp
{

class PTYCommand
{
	private:
		int master;
		pid_t childpid;
		std::string command;

	public:
		PTYCommand();
		~PTYCommand();

		void launch(const std::string& command);
		void wait();
		void kill();

		std::string readLine();
		void writeLine(const std::string& line);
};

}
#endif
#endif
